Skip to content

Villager POI Search Range Configs#217

Merged
Dueris merged 2 commits into
ver/26.1.2from
feat/reduce-poi-search-range-conf
May 9, 2026
Merged

Villager POI Search Range Configs#217
Dueris merged 2 commits into
ver/26.1.2from
feat/reduce-poi-search-range-conf

Conversation

@Dueris
Copy link
Copy Markdown
Member

@Dueris Dueris commented May 8, 2026

AcquirePoi searches always run with a range of 48 blocks. Villagers have 4 POI types that are run through 3 different behavior controllers in the mob brain, specifically searching for HOME, MEETING, JOB_SITE, and POTENTIAL_JOB_SITE. Note that JOB_SITE is the memory to validate and POTENTIAL_JOB_SITE is the memory to acquire in their shared behavior controller. These POIs are later validated once present via the ValidateNearbyPoi class, which actually validates them in a radius of 16 blocks, unlike 48 which is what the initial search is for.

With this in mind, there are 3 configs added that shrink the search radius from 48 to 16, to match the validator. These configs are as such:

  • reduceJobSitePoiSearchRange - Reduces the JOB_SITE/POTENTIAL_JOB_SITE POI search range
  • reduceHomePoiSearchRange - Reduces the HOME POI search range
  • reduceMeetingPointPoiSearchRange - Reduces the MEETING_POINT POI search range

Note that these configs are in kebab-case for the actual YAML config

This PR also disables these 3 behavior controllers from loading POI chunks if the chunk isn't currently loaded. There were some noticeable MSPT improvements, being roughly 18.21ms -> 13.57ms of Villager ticking(inactive tick included), in a single region with ~585 villagers. While not the most impactful optimization, this does help optimize the current heaviest behavior controllers for Villagers in Canvas, which is at least something.

Note that these options do cause slight deviation from Vanilla, however probably not entirely noticeable to the average player.

Copy link
Copy Markdown
Contributor

@MrMasrozYTLIVE MrMasrozYTLIVE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

Copy link
Copy Markdown
Member

@R00tB33rMan R00tB33rMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don’t see any breakages this’d ensue as-is and looks like all sites are covered!

@devnootnoot
Copy link
Copy Markdown
Contributor

I like the idea behind this, but I think this needs one change before merging.

Right now the range configs only control whether the search range is 16 or 48. However, the behavior controllers always pass false for shouldLoad, even when the new configs are disabled. That means the PR changes vanilla/Paper behavior even with all 3 options set to false, because villagers will no longer load chunks during these AcquirePoi searches, right?

So if a user leaves:

reduce-job-site-poi-search-range: false
reduce-home-poi-search-range: false
reduce-meeting-point-poi-search-range: false

they would probably expect vanilla-like behavior with a 48 block search range, but the chunk loading behavior is still changed.

I think the chunk-loading change should either have its own config, or shouldLoad should stay as PoiAccess.LOAD_FOR_SEARCHING when the relevant optimization is disabled.

I am also not fully convinced that matching AcquirePoi’s range to ValidateNearbyPoi’s 16 block radius is logically equivalent. Acquisition and validation are different steps. A villager may need to discover a bed/workstation/bell farther than 16 blocks away, while validation later only checks nearby/known POIs.

Could you split or adjust this so:

  • disabling the new configs preserves both the 48 block range and the original chunk-loading behavior
  • the no-chunk-load behavior is separately configurable, or tied clearly to an enabled optimization
  • the docs mention that reducing the range may prevent villagers from acquiring POIs between 17 and 48 blocks away

With that fixed, I think this would be much safer to merge.

@Dueris
Copy link
Copy Markdown
Member Author

Dueris commented May 9, 2026

Oh yea that makes sense

Ill get on that in a tiny bit

@Dueris
Copy link
Copy Markdown
Member Author

Dueris commented May 9, 2026

Fixed up

@devnootnoot
Copy link
Copy Markdown
Contributor

Looks good to me now, assuming this has been tested.

@Dueris Dueris merged commit 97f2831 into ver/26.1.2 May 9, 2026
@Dueris Dueris deleted the feat/reduce-poi-search-range-conf branch May 9, 2026 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants